feat(sr): add hybrid Session Replay support on Android - #1129
feat(sr): add hybrid Session Replay support on Android#1129JuanNaranjoDD wants to merge 7 commits into
Conversation
Record a Flutter view embedded in a native Android host into the host's replay instead of a standalone session, mirroring the iOS support. Add FlutterSessionReplayManager, a process-wide singleton owning the feature, core and engine registry, and make FlutterSessionReplayBridge per-engine so multiple engines share one feature. Route embedded segments and resources through _SessionReplayInternalProxy, reached via compileOnly and a guarded Class.forName check so pure-Flutter apps degrade instead of crashing. Expose enableSessionReplay() on FlutterFragment/FlutterActivity/FlutterView.
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7bcd24ac2a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
fuzzybinary
left a comment
There was a problem hiding this comment.
I think Codex's comments might be worth addressing. Also, once it's ready I'd like @jonathanmos to take a look - specifically at the need for the extra GSON work. I'd love to avoid that if possible.
What and why?
Adds hybrid (add-to-app) Session Replay support on Android, mirroring the iOS support added in #1100.
When a Flutter module runs inside a native Android host, Session Replay currently records it as its own standalone session, disconnected from the host's replay. This change lets the Flutter view be recorded into the host application's replay instead, so a single session shows the native and Flutter UI composited together.
How?
Process-wide ownership.
FlutterSessionReplayManager.sharedowns the single feature, core, engine registry, and slot registry.FlutterSessionReplayBridgebecomes a per-engine class (keyed by an engine token) rather than an object, somultiple Flutter engines in one process share one feature and one context broadcast instead of fighting over it.
Ordering invariant. The player can only composite a Flutter record into a placeholder wireframe that already exists in the same segment. Slot IDs are therefore minted only in
registerSlotand never on read, and segments buffer inpendingSegments(capped) while the embedding state is stillUNKNOWN, so nothing is emitted before its placeholder can exist. The native side holds records until the placeholder is written.Host API.
enableSessionReplay()is exposed onFlutterFragment,FlutterActivity, andFlutterView, re-registering the slot onON_START.Feature names. The Flutter features are renamed to
flutter-session-replayandflutter-session-replay-resources, matching iOS, so registering them no longer evicts the native Session Replay module from the core.Review checklist